package mbms.mobilebudget.entity;

import java.io.Serializable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName="user")
public class User implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2147271829983713877L;
	
	public static final String USERNAME_FIELD_NAME = "username";
	public static final String PASSWORD_FIELD_NAME = "password";
	
	@DatabaseField(generatedId = true)	
	private Integer id;
	
	@DatabaseField(canBeNull = false)
	private String firstName;
	
	@DatabaseField(canBeNull = false)
	private String lastName;
	
	@DatabaseField(canBeNull = false, unique = true, columnName=USERNAME_FIELD_NAME)
	private String username;
	
	@DatabaseField(canBeNull = false,columnName=PASSWORD_FIELD_NAME)
	private String password;
	
	@DatabaseField(canBeNull = false)
	private String commEmailAddress;
	
	@DatabaseField(canBeNull = true)
	private String statementEmailAddress;
	
	@DatabaseField(canBeNull = false)
	private String sequrityQuestion;
	
	@DatabaseField(canBeNull = false)
	private String sequrityQuestionAnswer;
	

	public User(){
		
	}
	
	public User(Integer id, String firstName, String lastName, String username,
			String password, String commEmailAddress,
			String statementEmailAddress, String sequrityQuestion,
			String sequrityQuestionAnswer) {
		this.id = id;
		this.firstName = firstName;
		this.lastName = lastName;
		this.username = username;
		this.password = password;
		this.commEmailAddress = commEmailAddress;
		this.statementEmailAddress = statementEmailAddress;
		this.sequrityQuestion = sequrityQuestion;
		this.sequrityQuestionAnswer = sequrityQuestionAnswer;
	}
	
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getCommEmailAddress() {
		return commEmailAddress;
	}
	public void setCommEmailAddress(String commEmailAddress) {
		this.commEmailAddress = commEmailAddress;
	}
	public String getStatementEmailAddress() {
		return statementEmailAddress;
	}
	public void setStatementEmailAddress(String statementEmailAddress) {
		this.statementEmailAddress = statementEmailAddress;
	}
	public String getSequrityQuestion() {
		return sequrityQuestion;
	}
	public void setSequrityQuestion(String sequrityQuestion) {
		this.sequrityQuestion = sequrityQuestion;
	}
	public String getSequrityQuestionAnswer() {
		return sequrityQuestionAnswer;
	}
	public void setSequrityQuestionAnswer(String sequrityQuestionAnswer) {
		this.sequrityQuestionAnswer = sequrityQuestionAnswer;
	}
	
	
}
